#!/bin/bash
ARCH=$(uname -m)

if [ "$ARCH" = "x86_64" ]; then
    echo "Intel-based Mac."
    conda_run_conda_forge_install pytorch==2.7.1 torchvision==0.22.1 torchaudio==2.7.1
    exit_code=$?
    if [ $exit_code -ne 0 ]; then
        echo "install pytorch==2.7.1 error: $exit_code"
        echo "install pytorch without specific version"
        conda_run_conda_forge_install pytorch torchvision torchaudio
    fi
else
    echo "Apple Silicon (M-series) Mac."
    conda_run_pip_install torch==2.8.0 torchvision torchaudio
    exit_code=$?
    if [ $exit_code -ne 0 ]; then
        echo "install pytorch==2.8.0 error: $exit_code"
        echo "install pytorch by conda"
        conda_run_conda_forge_install pytorch==2.8.0 torchvision torchaudio
    fi
fi


